home *** CD-ROM | disk | FTP | other *** search
- #ifndef __STDC__
- /* SYSV-compatible <string.h> */
- char *strcpy(), *strncpy();
- char *strchr(), *strrchr();
- int strcmp(), strncmp();
- char *strcat();
- #else
- /*
- * String functions.
- */
- #ifndef _STRING_H
- #define _STRING_H
-
- #include <stddef.h>
-
- #if ((defined(__STDC__)) && (!defined(__NO_PROTO__)))
-
- void * memcpy(void * dst, const void * src, size_t size);
- char * strcpy(char *dst, const char *src);
- char * strncpy(char *dst, const char *src, size_t size);
- char * strcat(char *dst, const char *src);
- char * strncat(char *dst, const char *src, size_t size);
- int memcmp(const void * s1, const void * s2, size_t size);
- int strcmp(const char *s1, const char *s2);
- int strncmp(const char *s1, const char *s2, size_t size);
- /* strcoll not implemented for now */
- size_t strcoll(char *to, size_t maxsize, const char *from);
- void * memchr(const void * s, int ucharwanted, size_t size);
- char * strchr(const char *s, int charwanted);
- size_t strcspn(const char *s, const char *reject);
- char * strpbrk(const char *s, const char *breakat);
- char * strrchr(const char *s, int charwanted);
- size_t strspn(const char *s, const char *accept);
- char * strstr(const char *s, const char *wanted);
- char * strtok(char *s, const char *delim);
- void * memset(void *s, int ucharfill, size_t size);
- size_t strlen(const char *s);
- char * strerror(int errnum);
-
- #ifndef __STRICT_ANSI__
- /*
- * from henry spencers string lib
- * these dont appear in ansi draft sec 4.11
- */
- void * memccpy(void * dst, const void * src, int ucharstop, size_t size);
- char * strlwr(char *);
- char * strrev(char *);
- char * strdup(const char *s);
-
- /*
- * V7 and BSD compatibility.
- */
- char * index(const char *s, int charwanted);
- char * rindex(const char *s, int charwanted);
- void bcopy(const void *src, void *dst, size_t length);
- int bcmp(const void *s1, const void *s2, size_t length);
- void bzero(void *dst, size_t length);
- #ifdef __MSHORT__
- void lbcopy(const void *src, void *dst, long length);
- int lbcmp(const void *s1, const void *s2, long length);
- void lbzero(void *dst, long length);
- #endif /* __MSHORT__ */
- #endif /* __STRICT_ANSI__ */
-
- #else /* not __STDC__ */
-
- extern void * memcpy();
- extern char * strcpy();
- extern char * strncpy();
- extern char * strcat();
- extern char * strncat();
- /* strcoll not implemented for now */
- extern size_t strcoll();
- extern void * memchr();
- extern char * strchr();
- extern size_t strcspn();
- extern char * strpbrk();
- extern char * strrchr();
- extern size_t strspn();
- extern char * strstr();
- extern char * strtok();
- extern void * memset();
- extern size_t strlen();
- extern char * strerror();
-
- #ifndef __STRICT_ANSI__
- /*
- * from henry spencers string lib
- * these dont appear in ansi draft sec 4.11
- */
- extern void * memccpy();
- extern char * strlwr();
- extern char * strrev();
- extern char * strdup();
-
- /*
- * V7 and BSD compatibility.
- */
- extern char * index();
- extern char * rindex();
- extern void bcopy();
- extern void bzero();
- #ifdef __MSHORT__
- extern void lbcopy();
- extern void lbzero();
- #endif /* __MSHORT__ */
- #endif /* __STRICT_ANSI__ */
-
- #endif /* __STDC__ */
-
- #ifndef __STRICT_ANSI__
- #ifndef __MSHORT__
- #define lbcopy bcopy
- #define lbcmp bcmp
- #define lbzero bzero
- #endif /* __MSHORT__ */
- #endif /* __STRICT_ANSI__ */
-
- /* some macro versions of functions. these are faster, but less
- forgiving of NULLs and similar nasties. to use the library functions,
- just #undef the appropriate things.
- */
-
- #if defined(__STDC__) && !defined(__NO_PROTO__)
- #if defined(__GNUC__) && !defined(__NO_INLINE__)
-
- static inline
- char *
- __strcat(char *dst, const char *src)
- {
- register char *dscan;
-
- for (dscan = dst; *dscan; dscan++) ;
- while (*dscan++ = *src++) ;
- return dst;
- }
-
- static inline
- char *
- __strcpy(char *dst, const char *src)
- {
- register char *dscan = dst;
- while (*dscan++ = *src++) ;
- return dst;
- }
-
- static inline
- size_t
- __strlen(const char *scan)
- {
- register size_t count = 0;
- while (*scan++) count++;
- return count;
- }
-
- #define strcat __strcat
- #define strcpy __strcpy
- #define strlen __strlen
-
- #endif /* __GNU__ && !__NO_INLINE__ */
- #endif /* __STDC__ && !__NO_PROTO__ */
-
- #endif /* _STRING_H */
-
- #endif
-